from flask import Flask, render_template, request
from flask_socketio import SocketIO

app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app)

@app.route('/')

def index():
    return render_template('chatbox.html')

@socketio.on('message')
def handle_message(msg):
    socketio.emit('response', msg, broadcast=True)

@socketio.on('message')
def handle_message(data):
    socketio.emit('response', data, broadcast=True)

if __name__ == '__main__':
    socketio.run(app, debug=True)